package com.xinqi.common.third.chat;

import com.xinqi.common.third.chat.help.RongyunHelp;
import io.rong.RongCloud;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 聊天配置
 *
 * @author linkai
 * @date 2023/2/21
 */
@Configuration
@ConditionalOnProperty(prefix = "third.chat.rongyun", name = {"key", "secret"})
@ConditionalOnClass({RongCloud.class})
@EnableConfigurationProperties(value = ChatProperties.class)
public class ChatConfig {
    @Bean
    public RongyunHelp RongyunHelp(ChatProperties chatProperties) {
        return new RongyunHelp(chatProperties);
    }
}
